package com.candy.service.impl;

import com.candy.dao.AccountDao;
import com.candy.dao.Impl.AccountDaoImpl;
import com.candy.service.AccountService;

import java.util.Date;

public class AccountServiceImpl implements AccountService {
//    属性
    private String username;
    private Integer age;
    private Date birthday;

    private AccountDao accountDaoImpl;

    public AccountServiceImpl() {
        System.out.println("调用了无参构造...");
    }

    public AccountServiceImpl(String username, Integer age, Date birthday) {
        this.username = username;
        this.age = age;
        this.birthday = birthday;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public Date getBirthday() {
        return birthday;
    }

    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }

    public AccountDao getAccountDaoImpl() {
        return accountDaoImpl;
    }

    public void setAccountDaoImpl(AccountDao accountDaoImpl) {
        this.accountDaoImpl = accountDaoImpl;
    }

    //进行存款的方法
    @Override
    public void save() {
        accountDaoImpl.saveMoney();
    }


    public  void start(){
        System.out.println("我在容器初始化的时候会被调用");
    }

    public  void end(){
        System.out.println("我在容器销毁的时候会被调用");
    }


    @Override
    public String toString() {
        return "AccountServiceImpl{" +
                "username='" + username + '\'' +
                ", age=" + age +
                ", birthday=" + birthday +
                ", accountDaoImpl=" + accountDaoImpl +
                '}';
    }
}
